/// 全局状态 * 计时器
import { defineStore } from 'pinia'
import { ref } from 'vue'

type OpenRecord = {
  key: Key
  label: string
  closable?: boolean
}

type OpenRecords = {
  key?: Key
  list: OpenRecord[]
}

export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)

  const openRecords = shallowReactive<OpenRecords>({
    list: [
      { key: '1', label: 'Tab 1', closable: false },
    ],
  })

  return {
    openRecords,
    get value() {
      return count
    },
    increment() {
      count.value++
    },
    decrement() {
      count.value--
    },
  }
})
